package com.wanmait.heatingrepair.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
/**
 * 过滤器
 * demo类用于创建项目时使包不为空
 * 1，避免上拉到仓库时不至于找不到此包
 * 2，用于测试
 * 3，项目后期可以删除，但切记更改项目时要及时上传和下拉
 *              --创建人：于谦涛
 *              2021.5.8
 */

//@WebFilter("/*")
public class DemoFilter implements Filter {


    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        //servlet 过滤器 监听器 从spring容器中获取对象使用下面的方式
//        ApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(servletRequest.getServletContext());
//        QuestionTypeService questionTypeService = applicationContext.getBean("questionTypeServiceImpl",QuestionTypeService.class);
//        List<QuestionType> questionTypes = questionTypeService.findAll();
//
//        questionTypes.forEach(System.out::println);
//
//        System.out.println("111111111111111111111111111");
//        System.out.println("login filter.........................");
//        filterChain.doFilter(servletRequest, servletResponse);
//        System.out.println("22222222222222222222222");
    }
}
